<?php

declare(strict_types=1);

namespace Api\InterfaceApi\v1\Work;

use Api\Request\v1\Work\CorpTagApiRequest;
use Api\Service\v1\Work\CorpTagApiService;
use Hyperf\Di\Annotation\Inject;
use Mine\MineApi;

class CorpTagApi extends MineApi
{
    #[Inject]
    protected CorpTagApiService $service;

    /**
     * 获取标签列表
     * @param CorpTagApiRequest $request
     * @return \Psr\Http\Message\ResponseInterface
     * @throws \Psr\Container\ContainerExceptionInterface
     * @throws \Psr\Container\NotFoundExceptionInterface
     */
    public function getList(CorpTagApiRequest $request): \Psr\Http\Message\ResponseInterface
    {
        return $this->success($this->service->getList($request->all()));
    }

    /**
     * 添加企业客户标签
     * @param CorpTagApiRequest $request
     * @return \Psr\Http\Message\ResponseInterface
     * @throws \Psr\Container\ContainerExceptionInterface
     * @throws \Psr\Container\NotFoundExceptionInterface
     */
    public function addCorpTag(CorpTagApiRequest $request): \Psr\Http\Message\ResponseInterface
    {
        return  $this->success($this->service->addCorpTag($request->all()));
    }

    public function editCorpTag(CorpTagApiRequest $request): \Psr\Http\Message\ResponseInterface
    {
        return  $this->service->editCorpTag($request->all()) ? $this->success() : $this->error();
    }

    public function delCorpTag(CorpTagApiRequest $request): \Psr\Http\Message\ResponseInterface
    {
        return $this->service->delCorpTag($request->all()) ? $this->success() : $this->error();
    }
}